<?php
/********************************************************
 *
 * 此文件的作用:
 *		文章表的入口
 *
 * @copyright Copyright (c) 2008-2009
 * @author Zero jnu.zero@gmail.com
 *
 ********************************************************/
defined('APP_DIR') or die('404 Not Found');

FLEA::loadClass('Common_Table');

class Table_Message extends Common_Table {
    var $tableName = 'message';
    var $primaryKey = 'message_id';

	function form($type, $data = null) {
		$this->_ui = FLEA::initWebControls();
		$form = array(
			'message_id' => $this->_ui->control('Hidden', 'message_id',
				array(
					'value' => $data['message_id']
				),
				true
			),
			'article_id' => $this->_ui->control('Hidden', 'article_id',
				array(
					'value' => $data['article_id']
				),
				true
			),
			'who' => $this->_ui->control('Textbox', 'who',
				array(
					'check' => 'isDate(\'YYYY-MM-DD\');',
					'value' => $data['message_id'],
					'showName' => '留言人'
				),
				true
			),
			'content' => $this->_ui->control('Fckeditor', 'content',
				array(
					'required' => 'true',
					'Value' => $data['content'],
					'showName' => '留言内容'
				),
				true
			),
			'type' => $this->_ui->control('DropdownList', 'type',
				array(
					'required' => 'true',
					'selected' => empty($data['type']) ? -1 : $data['type'],
					'items' => array(
						'留言' => 0,
						'教员意见' => 1
					),
					'showName' => '留言类型'
				),
				true
			)
		);
		return $form;
	}
}
